package com.course.redis.controller;

import com.course.common.model.pojo.Restaurant;
import com.course.common.response.BaseResponse;
import com.course.redis.service.RestaurantService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class RestaurantController {

    @Resource
    private RestaurantService restaurantService;

    /**
     * 根据餐厅 ID 查询餐厅数据
     *
     * @param restaurantId
     * @return
     */
    @GetMapping("{restaurantId}")
    public BaseResponse findById(@PathVariable Integer restaurantId) {
        Restaurant restaurant = restaurantService.findById(restaurantId);
        return new BaseResponse().success(restaurant);
    }

}